package com.getpebble.android.common.model;

import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import com.getpebble.android.common.core.util.PblContentProviderUtil;

public class PblDeviceJoinManifestModel extends PblDataModel {
    public static final Uri TABLE_URI = PblContentProviderUtil.getTableUri(getJoinedTableName());

    public static String getJoinedTableName() {
        return "manifests JOIN devices ON manifests.hw_platform = devices.hw_platform";
    }

    public static Cursor getFirmwareForDevice(ContentResolver contentResolver, String deviceAddress, String releaseType) {
        String[] projection = new String[]{"manifests.*"};
        String[] selectionArgs = new String[]{deviceAddress, releaseType};
        return contentResolver.query(TABLE_URI, projection, "devices.address = ? AND manifests.release_type = ?", selectionArgs, null);
    }
}
